#include "function actualize.h"
#include"stdafx.h"
bool CreatLNode(LinkList *L)
{
	ElemType Elem;
	Link LNodeList = (Link)malloc(sizeof(LNode));
	if (!LNodeList) {
		cout << "Error!"; return EXIT_FAILURE;
	}
	L->head = LNodeList;
	L->end = LNodeList;
	LNodeList->data.oeffi = 0;
	LNodeList->data.power = -1;
	LNodeList->next = NULL;
	bool chac = 1;
	cout << "Enter the LNodeomial(like 2+3x(3)+9x(6)):";
	for (int n = 0; n < L->Polnum; n++)
	{
		char useless;
		cin >> Elem.oeffi;
		if (chac == 0)Elem.oeffi = Elem.oeffi;
		useless = cin.get();
		switch (useless)
		{
		case'+':Elem.power = 0; chac = 1; break;
		case'-':Elem.power = 0; chac = 0; break;
		case'x':useless = cin.get(); cin >> Elem.power; useless = cin.get(); chac = 1;
		default:cout << "INVALID INPUT!"; break;
		}
		InsertLNode(L, Elem);
	}
	return EXIT_SUCCESS;
}